package org.jhulk.sprites;

/**
 * Base class for all playable characters
 */

import org.jhulk.utils.TileMapUtils;
import org.newdawn.slick.Image;
import org.newdawn.slick.tiled.TiledMap;

public class Character extends Image
{
    /* Should we render this character? */
    private boolean render = false;
    
    // Has this characters been placed yet?
    private boolean placed = false;

    /*Distance character moves in the X direction*/
    private int moveX = 42; //Should be the image width

    /*Distance character moves in the Y direction*/
    private int moveY = 42; //Should be the image height
    
    private int x;
    private int y;

	public Character(Image img) {
        super(img);
    }

    @Override
    public void draw()
    {
        if(this.doRender())
        {
            super.draw(this.getX(), this.getY());
        }
    }
    
    /**
     * Convenience method to initialize a character
     * Sets render and placed to true
     * @param x
     * @param y
     */
    public void placeChar(int x, int y)
    {
    	this.setX(x);
		this.setY(y);
		this.setRender(true);
		this.setPlaced(true);
    }
    
    /**
     * Determine if the provided x,y coords are where this Character is currently at
     * @param x
     * @param y
     * @return
     */
    public boolean charAtCoords(int x, int y)
    {
    	if(this.getX() == x && this.getY() == y)
    	{
    		return true;
    	} else {
    		return false;
    	}
    }

    public void turnLeft()
    {
        angle -= 90.0f;
    }

    public void turnRight()
    {
        angle += 90.0f;
    }

    public boolean doRender() {
        return render;
    }

    public void setRender(boolean render) {
        this.render = render;
    }

    public boolean isPlaced() {
		return placed;
	}

	public void setPlaced(boolean placed) {
		this.placed = placed;
	}

	public int getMoveX() {
        return moveX;
    }

    public int getMoveY() {
        return moveY;
    }
    
    public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

}
